package com.ryan.programming007.web.controllers;

import com.ryan.programming007.model.TutorialCategory;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "/component")
public class Component {

    @Autowired
    private Map<String, TutorialCategory> tutorialCategories;

    /**
     * Header
     *
     * @return
     */
    @RequestMapping(value = "/header")
    public ModelAndView header() {
        ModelAndView mav = new ModelAndView("header");
        return mav;
    }

    /**
     * nav
     *
     * @return
     */
    @RequestMapping(value = "/nav")
    public ModelAndView nav() {

        // the menu links
        Map<String, String> menu = new LinkedHashMap<String, String>();
        menu.put("/", "Home");
        menu.put("/about", "About us");
        menu.put("/tutorials", "Tutorials");
        menu.put("/contact", "Contact us");

        ModelAndView mav = new ModelAndView("nav");
        mav.addObject("menu", menu);
        return mav;
    }

    /**
     * Home page
     *
     * @return
     */
    @RequestMapping(value = "/home")
    public ModelAndView home() {
        ModelAndView mav = new ModelAndView("home");
        return mav;
    }

    /**
     * About page
     *
     * @return
     */
    @RequestMapping(value = "/about")
    public ModelAndView about() {
        ModelAndView mav = new ModelAndView("about");
        return mav;
    }

    /**
     * Contact page
     *
     * @return
     */
    @RequestMapping(value = "/contact")
    public ModelAndView contact() {
        ModelAndView mav = new ModelAndView("contact");
        return mav;
    }

    /**
     * Tutorials page
     *
     * @return
     */
    @RequestMapping(value = "/tutorials")
    public ModelAndView tutorials() {
        ModelAndView mav = new ModelAndView("tutorials");

        System.out.println(tutorialCategories);

        return mav;
    }

    /**
     * Specification and software page
     *
     * @return
     */
    @RequestMapping(value = "/specifications")
    public ModelAndView specifications() {
        ModelAndView mav = new ModelAndView("specifications");



        return mav;
    }
}
